#include <stdio.h>

double power(double x, int n) {
    if (n == 0) {
        return 1.0;
    } else if (n < 0) {
        return 1.0 / power(x, -n);
    } else {
        double temp = power(x, n / 2);
        if (n % 2 == 0) {
            return temp * temp;
        } else {
            return temp * temp * x;
        }
    }
}

int main() {
    double x = 2.0;
    int n = 3;
    printf("%lf\n", power(x, n));
    return 0;
}




